package com.micro.ai.files.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 文件分享实体类
 * 
 * @author micro-ai
 * @since 0.0.1
 */
@Data
@TableName("file_shares")
@Schema(description = "文件分享信息")
public class FileShare implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "分享ID", example = "share_123456789")
    private String id;

    /**
     * 租户ID
     */
    @Schema(description = "租户ID", example = "tenant_001")
    private String tenantId;

    /**
     * 文件ID
     */
    @Schema(description = "文件ID", example = "file_123")
    private String fileId;

    /**
     * 分享类型：public-公开, private-私有, password-密码, expire-过期
     */
    @Schema(description = "分享类型", example = "private", allowableValues = {"public", "private", "password", "expire"})
    private String shareType;

    /**
     * 分享令牌（唯一）
     */
    @Schema(description = "分享令牌", example = "abc123xyz789")
    private String shareToken;

    /**
     * 提取码
     */
    @Schema(description = "提取码", example = "1234")
    private String shareCode;

    /**
     * 密码（加密）
     */
    @Schema(description = "密码（加密）")
    private String passwordEncrypted;

    /**
     * 过期时间
     */
    @Schema(description = "过期时间")
    private LocalDateTime expireAt;

    /**
     * 最大下载次数，0表示无限制
     */
    @Schema(description = "最大下载次数", example = "100")
    private Integer maxDownloads;

    /**
     * 下载次数
     */
    @Schema(description = "下载次数", example = "10")
    private Integer downloadCount;

    /**
     * 预览次数
     */
    @Schema(description = "预览次数", example = "20")
    private Integer viewCount;

    /**
     * 是否允许预览
     */
    @Schema(description = "是否允许预览", example = "true")
    private Boolean isAllowPreview;

    /**
     * 是否允许下载
     */
    @Schema(description = "是否允许下载", example = "true")
    private Boolean isAllowDownload;

    /**
     * 创建人ID
     */
    @Schema(description = "创建人ID", example = "user_001")
    private String createdBy;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建时间", example = "2025-01-01 00:00:00")
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "更新时间", example = "2025-01-01 00:00:00")
    private LocalDateTime updatedAt;
}

